<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%><jsp:include page="../admin.jsp"></jsp:include>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<jsp:include page="../../../inc/js.jsp"></jsp:include>
<jsp:include page="../../../inc/css.jsp"></jsp:include>
<script type="text/javascript">
	function movePage(pageNo) {
		window.location = '?pageNo=' + pageNo + param();
	}
	function param() {
		var param = "";
		var cName = $("#cName").val();
		if (cName != null)
			param += "&cName=" + cName;
		return param;
	}
	$(document).ready(function() {
		$("#search").button().click(function() {
			movePage(1);
		});
		$.get("topCompanyList.do?top=10&type=fix&short&"+Math.random(), function(data) {
			$("#topCFix").append(data);
		});
		$.get("topCompanyList.do?top=10&type=view&short&"+Math.random(), function(data) {
			$("#topCView").append(data);
		});
	});
	function del(id){
		if(confirm('确认删除？')){
			$.ajax( {
				type : "get",
				url : "deleteCompany.do",
				data : {
					id : id
				},
				dataType:'json',
				error : function() {
					alert("加载错误");
				},
				success : function(data) {
					if(data.success){
						alert('操作成功！');
						location='?classid=${param.classid}&&pageTitle=${param.pageTitle}';
					}else alert('操作失败！\r\n'+data.err);
				}
			});
		}
	}
function fix(id, fix) {
	if (confirm('确定推荐/取消？'))
		$.ajax( {
					type : "post",
					url : "fixCompany.do?fix=" + fix + "&id=" + id,
					dataType : 'json',
					error : function() {
						alert("加载错误");
					},
					success : function(data) {
						if (data.success) {
							alert('操作成功！');
							location = '?classid=${param.classid}';
						} else
							alert("操作失败！" + data.err);
					}
				});
}
</script>
</head>
<body><jsp:include page="functionPath.jsp">
	<jsp:param value="${url}" name="url"/>
</jsp:include>
<table cellpadding="0" cellspacing="1" class="list">
	<thead>
		<tr>
			<td colspan="5" class="search"><label> 公司名称： </label> <input
				name="cName" id="cName" value="${param.cName }">
			<button id="search">查询</button>
			</td>
		</tr>
		<tr>
			<td>公司名称</td>
			<td>成立日期</td>
			<td>注册资金</td>
			<td>注册员工数</td>
			<td>操作</td>
		</tr>
	</thead>
	<tbody>
		<c:forEach var="e" items="${o.dataList}" varStatus="s">
			<tr>
				<td><a href="showCompany.do?id=${e.id}" target="_blank">${e.cName}
				</a> <c:if test="${e.fix>0}">
					<font color="red">[推荐]</font>
				</c:if></td>
				<td align="center">${e.buildDate }</td>
				<td align="center">${e.money }</td>
				<td align="center">${e.employee }</td>
				<td align="center"><c:if test="${e.fix==0}">
						<a href="javascript:fix(${e.id},1);"> <img
							src="lib/images/up.gif" /> </a>
					</c:if>
					<c:if test="${e.fix>0}">
						<a href="javascript:fix(${e.id},0);"> <img
							src="lib/images/last.gif" /> </a>
					</c:if>
					<a href="javascript:del(${e.id});"><img
						src="lib/images/close.gif" /></a></td>
			</tr>
		</c:forEach>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="5">${o.pageNav }</td>
		</tr>
	</tfoot>
</table>
</body>
</html>